
<!DOCTYPE HTML>
<html lang="zh-hans" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>5.4 假数据填充 · Laravel学习-从零开发论坛系统</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.3">
        <meta name="author" content="kaleozhou">
        
        
    
    <link rel="stylesheet" href="../gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-splitter/splitter.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-expandable-chapters-small/expandable-chapters-small.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-anchors/plugin.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-donate/plugin.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-anchor-navigation-ex/style/plugin.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-tbfed-pagefooter/footer.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-highlight/website.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-search/search.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-fontsettings/website.css">
                
            
        

    

    
        
    

        
    
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="../gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="5.html" />
    
    
    <link rel="prev" href="3.html" />
    

    
        <link rel="shortcut icon" href='../book.ico' type="image/x-icon">
    
    
        <link rel="bookmark" href='../book.ico' type="image/x-icon">
    
    
        <link rel="apple-touch-icon" href='../book.ico'>
    
    
        
        <link rel="apple-touch-icon" sizes="120x120" href="../book.ico">
        
        <link rel="apple-touch-icon" sizes="180x180" href="../book.ico">
        
    

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="输入并搜索" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    
    
        
        <li>
            <a href="http://www.kaleozhou.top" target="_blank" class="custom-link">我的博客</a>
        </li>
    
    

    
    <li class="divider"></li>
    

    
        
        
    
        <li class="chapter " data-level="1.1" data-path="../">
            
                <a href="../">
            
                    
                    序言
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="../chapter1/1.html">
            
                <a href="../chapter1/1.html">
            
                    
                    第一章 开发环境搭建
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3" data-path="../chapter2/readme.html">
            
                <a href="../chapter2/readme.html">
            
                    
                    第二章 创建应用及布局
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.1" data-path="../chapter2/1.html">
            
                <a href="../chapter2/1.html">
            
                    
                    2.1 创建应用
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.2" data-path="../chapter2/2.html">
            
                <a href="../chapter2/2.html">
            
                    
                    2.2 创建布局文件
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.3" data-path="../chapter2/3.html">
            
                <a href="../chapter2/3.html">
            
                    
                    2.3 创建首页展示
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.4" data-path="../chapter2/4.html">
            
                <a href="../chapter2/4.html">
            
                    
                    2.4 调整样式
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.4" data-path="../chapter3/readme.html">
            
                <a href="../chapter3/readme.html">
            
                    
                    第三章 laravel组件的使用
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.4.1" data-path="../chapter3/1.html">
            
                <a href="../chapter3/1.html">
            
                    
                    3.1 用户脚手架
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.2" data-path="../chapter3/2.html">
            
                <a href="../chapter3/2.html">
            
                    
                    3.2 注册验证码
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.3" data-path="../chapter3/3.html">
            
                <a href="../chapter3/3.html">
            
                    
                    3.3 邮箱验证
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.4" data-path="../chapter3/4.html">
            
                <a href="../chapter3/4.html">
            
                    
                    3.4 密码重置
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.5" data-path="../chapter4/readme.html">
            
                <a href="../chapter4/readme.html">
            
                    
                    第四章 基础功能开发
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.5.1" data-path="../chapter4/1.html">
            
                <a href="../chapter4/1.html">
            
                    
                    4.1 个人页面
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.2" data-path="../chapter4/2.html">
            
                <a href="../chapter4/2.html">
            
                    
                    4.2 编辑个人资料
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.3" data-path="../chapter4/3.html">
            
                <a href="../chapter4/3.html">
            
                    
                    4.3 显示个人资料
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.4" data-path="../chapter4/4.html">
            
                <a href="../chapter4/4.html">
            
                    
                    4.4 上传头像
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.6" data-path="readme.html">
            
                <a href="readme.html">
            
                    
                    第五章 帖子功能开发
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.6.1" data-path="1.html">
            
                <a href="1.html">
            
                    
                    5.1 帖子分类
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.2" data-path="2.html">
            
                <a href="2.html">
            
                    
                    5.2 代码生成器
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.3" data-path="3.html">
            
                <a href="3.html">
            
                    
                    5.3 生成话题骨架
            
                </a>
            

            
        </li>
    
        <li class="chapter active" data-level="1.6.4" data-path="4.html">
            
                <a href="4.html">
            
                    
                    5.4 假数据填充
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.5" data-path="5.html">
            
                <a href="5.html">
            
                    
                    5.5 话题列表页面
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.6" data-path="6.html">
            
                <a href="6.html">
            
                    
                    5.6 性能优化
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.7" data-path="7.html">
            
                <a href="7.html">
            
                    
                    5.7 分类下的话题列表
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.8" data-path="8.html">
            
                <a href="8.html">
            
                    
                    5.8 话题排序
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.9" data-path="9.html">
            
                <a href="9.html">
            
                    
                    5.9 用户发布的话题
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.7" data-path="../chapter6/readme.html">
            
                <a href="../chapter6/readme.html">
            
                    
                    第六章 话题开发
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.7.1" data-path="../chapter6/1.html">
            
                <a href="../chapter6/1.html">
            
                    
                    6.1 新建话题
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.2" data-path="../chapter6/2.html">
            
                <a href="../chapter6/2.html">
            
                    
                    6.2 编辑器优化
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.3" data-path="../chapter6/3.html">
            
                <a href="../chapter6/3.html">
            
                    
                    6.3 上传图片
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.4" data-path="../chapter6/4.html">
            
                <a href="../chapter6/4.html">
            
                    
                    6.4 显示帖子
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.5" data-path="../chapter6/5.html">
            
                <a href="../chapter6/5.html">
            
                    
                    6.5 XSS安全漏洞
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.6" data-path="../chapter6/6.html">
            
                <a href="../chapter6/6.html">
            
                    
                    6.6 编辑帖子
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            本书使用 GitBook 发布
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href=".." >5.4 假数据填充</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <div id="anchor-navigation-ex-navbar"><i class="fa fa-navicon"></i><ul><li><span class="title-icon "></span><a href="#54-&#x5047;&#x6570;&#x636E;&#x586B;&#x5145;"><b></b>5.4 &#x5047;&#x6570;&#x636E;&#x586B;&#x5145;</a></li><ul><li><span class="title-icon "></span><a href="#&#x5047;&#x6570;&#x636E;&#x586B;&#x5145;"><b></b>&#x5047;&#x6570;&#x636E;&#x586B;&#x5145;</a></li><li><span class="title-icon "></span><a href="#&#x586B;&#x5145;&#x7528;&#x6237;&#x6570;&#x636E;"><b></b>&#x586B;&#x5145;&#x7528;&#x6237;&#x6570;&#x636E;</a></li><ul><li><span class="title-icon "></span><a href="#1-&#x7528;&#x6237;&#x7684;&#x6570;&#x636E;&#x5DE5;&#x5382;"><b></b>1. &#x7528;&#x6237;&#x7684;&#x6570;&#x636E;&#x5DE5;&#x5382;</a></li><li><span class="title-icon "></span><a href="#2-&#x7528;&#x6237;&#x6570;&#x636E;&#x586B;&#x5145;"><b></b>2. &#x7528;&#x6237;&#x6570;&#x636E;&#x586B;&#x5145;</a></li><li><span class="title-icon "></span><a href="#3-&#x6CE8;&#x518C;&#x6570;&#x636E;&#x586B;&#x5145;"><b></b>3. &#x6CE8;&#x518C;&#x6570;&#x636E;&#x586B;&#x5145;</a></li></ul><li><span class="title-icon "></span><a href="#&#x586B;&#x5145;&#x8BDD;&#x9898;&#x6570;&#x636E;"><b></b>&#x586B;&#x5145;&#x8BDD;&#x9898;&#x6570;&#x636E;</a></li><ul><li><span class="title-icon "></span><a href="#1-&#x6570;&#x636E;&#x6A21;&#x578B;"><b></b>1. &#x6570;&#x636E;&#x6A21;&#x578B;</a></li><li><span class="title-icon "></span><a href="#2-&#x8BDD;&#x9898;&#x7684;&#x6570;&#x636E;&#x5DE5;&#x5382;"><b></b>2. &#x8BDD;&#x9898;&#x7684;&#x6570;&#x636E;&#x5DE5;&#x5382;</a></li><li><span class="title-icon "></span><a href="#3-&#x8BDD;&#x9898;&#x7684;&#x6570;&#x636E;&#x586B;&#x5145;"><b></b>3. &#x8BDD;&#x9898;&#x7684;&#x6570;&#x636E;&#x586B;&#x5145;</a></li><li><span class="title-icon "></span><a href="#4-&#x6CE8;&#x518C;&#x6570;&#x636E;&#x586B;&#x5145;"><b></b>4. &#x6CE8;&#x518C;&#x6570;&#x636E;&#x586B;&#x5145;</a></li></ul><li><span class="title-icon "></span><a href="#&#x6267;&#x884C;&#x586B;&#x5145;&#x547D;&#x4EE4;"><b></b>&#x6267;&#x884C;&#x586B;&#x5145;&#x547D;&#x4EE4;</a></li></ul></ul></div><a href="#54-&#x5047;&#x6570;&#x636E;&#x586B;&#x5145;" id="anchorNavigationExGoTop"><i class="fa fa-arrow-up"></i></a><h1 id="54-&#x5047;&#x6570;&#x636E;&#x586B;&#x5145;"><a name="54-&#x5047;&#x6570;&#x636E;&#x586B;&#x5145;" class="anchor-navigation-ex-anchor" href="#54-&#x5047;&#x6570;&#x636E;&#x586B;&#x5145;"><i class="fa fa-link" aria-hidden="true"></i></a><a name="54-&#x5047;&#x6570;&#x636E;&#x586B;&#x5145;" class="plugin-anchor" href="#54-&#x5047;&#x6570;&#x636E;&#x586B;&#x5145;"><i class="fa fa-link" aria-hidden="true"></i></a>5.4 &#x5047;&#x6570;&#x636E;&#x586B;&#x5145;</h1>
<h2 id="&#x5047;&#x6570;&#x636E;&#x586B;&#x5145;"><a name="&#x5047;&#x6570;&#x636E;&#x586B;&#x5145;" class="anchor-navigation-ex-anchor" href="#&#x5047;&#x6570;&#x636E;&#x586B;&#x5145;"><i class="fa fa-link" aria-hidden="true"></i></a><a name="&#x5047;&#x6570;&#x636E;&#x586B;&#x5145;" class="plugin-anchor" href="#&#x5047;&#x6570;&#x636E;&#x586B;&#x5145;"><i class="fa fa-link" aria-hidden="true"></i></a>&#x5047;&#x6570;&#x636E;&#x586B;&#x5145;</h2>
<p>&#x76EE;&#x524D;&#x6211;&#x4EEC;&#x6570;&#x636E;&#x5E93;&#x4E2D;&#x5E16;&#x5B50;&#x6570;&#x636E;&#x4E3A;&#x7A7A;&#xFF0C;&#x56E0;&#x6B64;&#x8BDD;&#x9898;&#x5217;&#x8868;&#x9875;&#x9762;&#x5982;&#x4E0B;:
<img src="http://images.kaleozhou.top/5.4-01.png" alt="5.4-01.png">
&#x5728;&#x5F00;&#x53D1;&#x8BDD;&#x9898;&#x5217;&#x8868;&#x4E4B;&#x524D;&#xFF0C;&#x6211;&#x4EEC;&#x9700;&#x8981;&#x4E00;&#x4E9B;&#x6570;&#x636E;&#x6765;&#x8F85;&#x52A9;&#xFF0C;&#x5047;&#x6570;&#x636E;&#x751F;&#x6210;&#x903B;&#x8F91;&#x5982;&#x4E0B;:</p>
<ul>
<li>&#x586B;&#x5145;10&#x6761;&#x7528;&#x6237;&#x6570;&#x636E;&#xFF0C;&#x4F5C;&#x4E3A;&#x8BDD;&#x9898;&#x7684;&#x4F5C;&#x8005;&#x4F7F;&#x7528;</li>
<li>100&#x6761;&#x8BDD;&#x9898;&#x6570;&#x636E;&#xFF0C;&#x8FD9;&#x6837;&#x6211;&#x4EEC;&#x5C31;&#x80FD;&#x6D4B;&#x8BD5;&#x5206;&#x9875;&#x529F;&#x80FD;</li>
<li>&#x586B;&#x5145;&#x8BDD;&#x9898;&#x5206;&#x7C7B;&#x968F;&#x673A;</li>
<li>&#x586B;&#x5145;&#x8BDD;&#x9898;&#x65F6;&#x4F5C;&#x8005;&#x968F;&#x673A;</li>
</ul>
<h2 id="&#x586B;&#x5145;&#x7528;&#x6237;&#x6570;&#x636E;"><a name="&#x586B;&#x5145;&#x7528;&#x6237;&#x6570;&#x636E;" class="anchor-navigation-ex-anchor" href="#&#x586B;&#x5145;&#x7528;&#x6237;&#x6570;&#x636E;"><i class="fa fa-link" aria-hidden="true"></i></a><a name="&#x586B;&#x5145;&#x7528;&#x6237;&#x6570;&#x636E;" class="plugin-anchor" href="#&#x586B;&#x5145;&#x7528;&#x6237;&#x6570;&#x636E;"><i class="fa fa-link" aria-hidden="true"></i></a>&#x586B;&#x5145;&#x7528;&#x6237;&#x6570;&#x636E;</h2>
<p>&#x8BDD;&#x9898;&#x6570;&#x636E;&#x4E2D;&#x9700;&#x8981;&#x4F7F;&#x7528;&#x3010;&#x7528;&#x6237;&#x6570;&#x636E;&#x3011;&#x4F5C;&#x4E3A;&#x8BDD;&#x9898;&#x7684;&#x4F5C;&#x8005;&#xFF0C;&#x6709;&#x4F9D;&#x8D56;&#x5173;&#x7CFB;&#xFF0C;&#x6545;&#x6211;&#x4EEC;&#x5148;&#x586B;&#x5145;&#x7528;&#x6237;&#x6570;&#x636E;&#x3002;
&#x7528;&#x6237;&#x7684;&#x5047;&#x6570;&#x636E;&#x586B;&#x5145;&#x6D89;&#x53CA;&#x5230;&#x4EE5;&#x4E0B;&#x51E0;&#x4E2A;&#x6587;&#x4EF6;:</p>
<ol>
<li>&#x6570;&#x636E;&#x6A21;&#x578B; User.php</li>
<li>&#x7528;&#x6237;&#x7684;&#x6570;&#x636E;&#x5DE5;&#x5382; database/factories/UserFactory.php</li>
<li>&#x7528;&#x6237;&#x7684;&#x6570;&#x636E;&#x586B;&#x5145; database/seeds/UsersTableSeeder.php</li>
<li>&#x6CE8;&#x518C;&#x6570;&#x636E;&#x586B;&#x5145; database/seeds/DatabaseSeeder.php</li>
</ol>
<p>&#x6570;&#x636E;&#x6A21;&#x578B;&#x524D;&#x9762;&#x6211;&#x4EEC;&#x5DF2;&#x7ECF;&#x5B9A;&#x5236;&#x4E86;&#xFF0C;&#x63A5;&#x4E0B;&#x6765;&#x6211;&#x4EEC;&#x4ECE;UserFactory&#x5F00;&#x59CB;&#x3002;</p>
<h3 id="1-&#x7528;&#x6237;&#x7684;&#x6570;&#x636E;&#x5DE5;&#x5382;"><a name="1-&#x7528;&#x6237;&#x7684;&#x6570;&#x636E;&#x5DE5;&#x5382;" class="anchor-navigation-ex-anchor" href="#1-&#x7528;&#x6237;&#x7684;&#x6570;&#x636E;&#x5DE5;&#x5382;"><i class="fa fa-link" aria-hidden="true"></i></a><a name="1-&#x7528;&#x6237;&#x7684;&#x6570;&#x636E;&#x5DE5;&#x5382;" class="plugin-anchor" href="#1-&#x7528;&#x6237;&#x7684;&#x6570;&#x636E;&#x5DE5;&#x5382;"><i class="fa fa-link" aria-hidden="true"></i></a>1. &#x7528;&#x6237;&#x7684;&#x6570;&#x636E;&#x5DE5;&#x5382;</h3>
<p>Laravel&#x6846;&#x67B6;&#x81EA;&#x5E26;&#x4E86;UserFactory.php&#x4F5C;&#x4E3A;&#x793A;&#x4F8B;&#x6587;&#x4EF6;:</p>
<pre><code>&#x279C; kaleo@zhou  ~/Code/kaleobbs git:(master) vim database/factories/UserFactory.php
</code></pre><p>&#x4FEE;&#x6539;&#x5982;&#x4E0B;</p>
<pre><code>&lt;?php

use Illuminate\Support\Str;
use Faker\Generator as Faker;

/*
|--------------------------------------------------------------------------
| Model Factories
|--------------------------------------------------------------------------
|
| This directory should contain each of the model factory definitions for
| your application. Factories provide a convenient way to generate new
| model instances for testing / seeding your application&apos;s database.
|
*/

$factory-&gt;define(App\Models\User::class, function (Faker $faker) {
    return [
        &apos;name&apos; =&gt; $faker-&gt;name,
        &apos;email&apos; =&gt; $faker-&gt;unique()-&gt;safeEmail,
        &apos;email_verified_at&apos; =&gt; now(),
        &apos;password&apos; =&gt; &apos;$2y$10$TKh8H1.PfQx37YgCzwiKb.KjNyWgaHb9cbcoQgdIVFlYg7B77UdFm&apos;, // secret
        &apos;remember_token&apos; =&gt; Str::random(10),
        &apos;introduction&apos;=&gt;$faker-&gt;sentence(),
        &apos;created_at&apos;=&gt;$date_time,
        &apos;updated_at&apos;=&gt;$date_time,
    ];
});
</code></pre><h3 id="2-&#x7528;&#x6237;&#x6570;&#x636E;&#x586B;&#x5145;"><a name="2-&#x7528;&#x6237;&#x6570;&#x636E;&#x586B;&#x5145;" class="anchor-navigation-ex-anchor" href="#2-&#x7528;&#x6237;&#x6570;&#x636E;&#x586B;&#x5145;"><i class="fa fa-link" aria-hidden="true"></i></a><a name="2-&#x7528;&#x6237;&#x6570;&#x636E;&#x586B;&#x5145;" class="plugin-anchor" href="#2-&#x7528;&#x6237;&#x6570;&#x636E;&#x586B;&#x5145;"><i class="fa fa-link" aria-hidden="true"></i></a>2. &#x7528;&#x6237;&#x6570;&#x636E;&#x586B;&#x5145;</h3>
<p>&#x6267;&#x884C;&#x4EE5;&#x4E0B;&#x547D;&#x4EE4;&#x751F;&#x6210;&#x6570;&#x636E;&#x586B;&#x5145;&#x6587;&#x4EF6;:</p>
<pre><code>vagrant@homestead:~/Code/kaleobbs$ php artisan make:seed UsersTableSeeder
Seeder created successfully.
</code></pre><p>&#x6253;&#x5F00;</p>
<pre><code>&#x279C; kaleo@zhou  ~/Code/kaleobbs git:(master) &#x2717; vim database/seeds/UsersTableSeeder.php
</code></pre><p>&#x4FEE;&#x6539;&#x5185;&#x5BB9;&#x5982;&#x4E0B;:</p>
<pre><code>&lt;?php

use Illuminate\Database\Seeder;
use App\Models\User;

class UsersTableSeeder extends Seeder
{
    /**
     * Run the database seeds.
     *
     * @return void
     */
    public function run()
    {
        //&#x83B7;&#x53D6;Faker&#x5B9E;&#x4F8B;
        $faker=app(Faker\Generator::class);
        //&#x5934;&#x50CF;&#x5047;&#x6570;&#x636E;
          $avatars = [
            &apos;https://iocaffcdn.phphub.org/uploads/images/201710/14/1/s5ehp11z6s.png&apos;,
            &apos;https://iocaffcdn.phphub.org/uploads/images/201710/14/1/Lhd1SHqu86.png&apos;,
            &apos;https://iocaffcdn.phphub.org/uploads/images/201710/14/1/LOnMrqbHJn.png&apos;,
            &apos;https://iocaffcdn.phphub.org/uploads/images/201710/14/1/xAuDMxteQy.png&apos;,
            &apos;https://iocaffcdn.phphub.org/uploads/images/201710/14/1/ZqM7iaP4CR.png&apos;,
            &apos;https://iocaffcdn.phphub.org/uploads/images/201710/14/1/NDnzMutoxX.png&apos;,
        ];
        //&#x751F;&#x6210;&#x6570;&#x636E;&#x96C6;&#x5408;
        $users=factory(User::class)
            -&gt;times(10)
            -&gt;make()
            -&gt;each(function($user,$index)
            use($faker,$avatars){
                //&#x4ECE;&#x5934;&#x50CF;&#x6570;&#x7EC4;&#x4E2D;&#x968F;&#x673A;&#x53D6;&#x51FA;&#x4E00;&#x4E2A;&#x5E76;&#x8D4B;&#x503C;
                $user-&gt;avatar=$faker-&gt;randomElement($avatars);
            });
        //&#x8BA9;&#x9690;&#x85CF;&#x5B57;&#x6BB5;&#x53EF;&#x89C1;&#xFF0C;&#x5E76;&#x5C06;&#x6570;&#x636E;&#x96C6;&#x5408;&#x8F6C;&#x6362;&#x4E3A;&#x6570;&#x7EC4;
        $user_array=$users-&gt;makeVisible([&apos;password&apos;,&apos;remember_token&apos;])-&gt;toArray();
        //&#x63D2;&#x5165;&#x5230;&#x6570;&#x636E;&#x5E93;&#x4E2D;
        User::insert($user_array);
        //&#x5355;&#x72EC;&#x5904;&#x7406;&#x7B2C;&#x4E00;&#x4E2A;&#x7528;&#x6237;&#x7684;&#x6570;&#x636E;
        $user=User::find(1);
        $user-&gt;name=&apos;kaleozhou&apos;;
        $user-&gt;email=&apos;kaleozhou@hotmail.com&apos;;
        $user-&gt;avatar=&apos;https://i.loli.net/2019/04/14/5cb2f6b75770d.jpg&apos;;
        $user-&gt;save();
    }
}
</code></pre><h3 id="3-&#x6CE8;&#x518C;&#x6570;&#x636E;&#x586B;&#x5145;"><a name="3-&#x6CE8;&#x518C;&#x6570;&#x636E;&#x586B;&#x5145;" class="anchor-navigation-ex-anchor" href="#3-&#x6CE8;&#x518C;&#x6570;&#x636E;&#x586B;&#x5145;"><i class="fa fa-link" aria-hidden="true"></i></a><a name="3-&#x6CE8;&#x518C;&#x6570;&#x636E;&#x586B;&#x5145;" class="plugin-anchor" href="#3-&#x6CE8;&#x518C;&#x6570;&#x636E;&#x586B;&#x5145;"><i class="fa fa-link" aria-hidden="true"></i></a>3. &#x6CE8;&#x518C;&#x6570;&#x636E;&#x586B;&#x5145;</h3>
<p>&#x63A5;&#x4E0B;&#x6765;&#x6CE8;&#x518C;&#x6570;&#x636E;&#x7C7B;</p>
<pre><code>&#x279C; kaleo@zhou  ~/Code/kaleobbs git:(master) &#x2717; vim database/seeds/DatabaseSeeder.php
</code></pre><p>&#x4FEE;&#x6539;&#x5982;&#x4E0B;:</p>
<pre><code>&lt;?php

use Illuminate\Database\Seeder;

class DatabaseSeeder extends Seeder
{
    /**
     * Seed the application&apos;s database.
     *
     * @return void
     */
    public function run()
    {
         $this-&gt;call(UsersTableSeeder::class);
        //$this-&gt;call(TopicsTableSeeder::class);
    }
}
</code></pre><p>&#x6267;&#x884C;&#x547D;&#x4EE4;:</p>
<pre><code>vagrant@homestead:~/Code/kaleobbs$ php artisan db:seed
Seeding: UsersTableSeeder
Database seeding completed successfully.
</code></pre><p>&#x7ED3;&#x679C;&#x5982;&#x4E0B;:
<img src="http://images.kaleozhou.top/5.4-02.png" alt="5.4-02.png">
&#x53D1;&#x73B0;&#x6709;12&#x4E2A;&#x7528;&#x6237;&#xFF0C;&#x53BB;&#x6389;&#x591A;&#x4F59;&#x7684;&#x6570;&#x636E;</p>
<pre><code>vagrant@homestead:~/Code/kaleobbs$ php artisan migrate:refresh --seed
Rolling back: 2019_04_14_163055_create_topics_table
Rolled back:  2019_04_14_163055_create_topics_table
Rolling back: 2019_04_14_122835_seed_categories_data
Rolled back:  2019_04_14_122835_seed_categories_data
Rolling back: 2019_04_14_091133_create_categories_table
Rolled back:  2019_04_14_091133_create_categories_table
Rolling back: 2019_04_08_202505_add_avatar_and_introduction_to_users_table
Rolled back:  2019_04_08_202505_add_avatar_and_introduction_to_users_table
Rolling back: 2014_10_12_100000_create_password_resets_table
Rolled back:  2014_10_12_100000_create_password_resets_table
Rolling back: 2014_10_12_000000_create_users_table
Rolled back:  2014_10_12_000000_create_users_table
Migrating: 2014_10_12_000000_create_users_table
Migrated:  2014_10_12_000000_create_users_table
Migrating: 2014_10_12_100000_create_password_resets_table
Migrated:  2014_10_12_100000_create_password_resets_table
Migrating: 2019_04_08_202505_add_avatar_and_introduction_to_users_table
Migrated:  2019_04_08_202505_add_avatar_and_introduction_to_users_table
Migrating: 2019_04_14_091133_create_categories_table
Migrated:  2019_04_14_091133_create_categories_table
Migrating: 2019_04_14_122835_seed_categories_data
Migrated:  2019_04_14_122835_seed_categories_data
Migrating: 2019_04_14_163055_create_topics_table
Migrated:  2019_04_14_163055_create_topics_table
Seeding: UsersTableSeeder
Database seeding completed successfully.
</code></pre><h2 id="&#x586B;&#x5145;&#x8BDD;&#x9898;&#x6570;&#x636E;"><a name="&#x586B;&#x5145;&#x8BDD;&#x9898;&#x6570;&#x636E;" class="anchor-navigation-ex-anchor" href="#&#x586B;&#x5145;&#x8BDD;&#x9898;&#x6570;&#x636E;"><i class="fa fa-link" aria-hidden="true"></i></a><a name="&#x586B;&#x5145;&#x8BDD;&#x9898;&#x6570;&#x636E;" class="plugin-anchor" href="#&#x586B;&#x5145;&#x8BDD;&#x9898;&#x6570;&#x636E;"><i class="fa fa-link" aria-hidden="true"></i></a>&#x586B;&#x5145;&#x8BDD;&#x9898;&#x6570;&#x636E;</h2>
<p>&#x7528;&#x6237;&#x6570;&#x636E;&#x5DF2;&#x7ECF;&#x51C6;&#x5907;&#x597D;&#x4E86;&#xFF0C;&#x63A5;&#x4E0B;&#x6765;&#x6211;&#x4EEC;&#x5904;&#x7406;&#x8BDD;&#x9898;&#x6570;&#x636E;&#x586B;&#x5145;&#x3002;&#x8BDD;&#x9898;&#x7684;&#x5047;&#x6570;&#x636E;&#x6D89;&#x53CA;&#x5230;&#x4E00;&#x4E0B;&#x51E0;&#x4E2A;&#x6587;&#x4EF6;:</p>
<ol>
<li>&#x6570;&#x636E;&#x6A21;&#x578B;Topic.php</li>
<li>&#x8BDD;&#x9898;&#x7684;&#x6570;&#x636E;&#x5DE5;&#x5382; database/factories/TopicFactory.php</li>
<li>&#x8BDD;&#x9898;&#x7684;&#x6570;&#x636E;&#x586B;&#x5145; database/seeds/TopicsTableSeeder.php</li>
<li>&#x6CE8;&#x518C;&#x6570;&#x636E;&#x586B;&#x5145; database/seeds/DatabaseSeeder.php</li>
</ol>
<p>&#x4EE3;&#x7801;&#x751F;&#x6210;&#x5668;&#x5DF2;&#x7ECF;&#x4E3A;&#x6211;&#x4EEC;&#x751F;&#x6210;&#x4E86;&#x6240;&#x9700;&#x8981;&#x7684;&#x6587;&#x4EF6;&#xFF0C;&#x5E76;&#x4E14;&#x81EA;&#x52A8;&#x5728;DatabaseSeeder&#x4E2D;&#x52A0;&#x5165;&#x4E86;TopicsTableSeeder&#x7684;&#x8C03;&#x7528;</p>
<h3 id="1-&#x6570;&#x636E;&#x6A21;&#x578B;"><a name="1-&#x6570;&#x636E;&#x6A21;&#x578B;" class="anchor-navigation-ex-anchor" href="#1-&#x6570;&#x636E;&#x6A21;&#x578B;"><i class="fa fa-link" aria-hidden="true"></i></a><a name="1-&#x6570;&#x636E;&#x6A21;&#x578B;" class="plugin-anchor" href="#1-&#x6570;&#x636E;&#x6A21;&#x578B;"><i class="fa fa-link" aria-hidden="true"></i></a>1. &#x6570;&#x636E;&#x6A21;&#x578B;</h3>
<pre><code>&#x279C; kaleo@zhou  ~/Code/kaleobbs git:(master) vim app/Models/Topic.php
</code></pre><p>&#x5185;&#x5BB9;</p>
<pre><code>&lt;?php

namespace App\Models;

class Topic extends Model
{
    protected $fillable = [&apos;title&apos;, &apos;body&apos;, &apos;user_id&apos;, &apos;category_id&apos;, &apos;reply_count&apos;, &apos;view_count&apos;, &apos;last_reply_user_id&apos;, &apos;order&apos;, &apos;excerpt&apos;, &apos;slug&apos;];
}
</code></pre><p>&#x6682;&#x4E0D;&#x4FEE;&#x6539;</p>
<h3 id="2-&#x8BDD;&#x9898;&#x7684;&#x6570;&#x636E;&#x5DE5;&#x5382;"><a name="2-&#x8BDD;&#x9898;&#x7684;&#x6570;&#x636E;&#x5DE5;&#x5382;" class="anchor-navigation-ex-anchor" href="#2-&#x8BDD;&#x9898;&#x7684;&#x6570;&#x636E;&#x5DE5;&#x5382;"><i class="fa fa-link" aria-hidden="true"></i></a><a name="2-&#x8BDD;&#x9898;&#x7684;&#x6570;&#x636E;&#x5DE5;&#x5382;" class="plugin-anchor" href="#2-&#x8BDD;&#x9898;&#x7684;&#x6570;&#x636E;&#x5DE5;&#x5382;"><i class="fa fa-link" aria-hidden="true"></i></a>2. &#x8BDD;&#x9898;&#x7684;&#x6570;&#x636E;&#x5DE5;&#x5382;</h3>
<pre><code>

</code></pre><p>&#x4FEE;&#x6539;&#x5982;&#x4E0B;</p>
<pre><code>&lt;?php

use Faker\Generator as Faker;

$factory-&gt;define(App\Models\Topic::class, function (Faker $faker) {
    $sentence=$faker-&gt;sentence();
    //&#x968F;&#x673A;&#x53D6;&#x4E00;&#x4E2A;&#x6708;&#x4EE5;&#x5185;&#x7684;&#x4E8B;&#x4EF6;
    $updated_at=$faker-&gt;dateTimeThisMonth();
    //&#x4F20;&#x53C2;&#x4E3A;&#x751F;&#x6210;&#x6700;&#x5927;&#x65F6;&#x95F4;&#x4E0D;&#x8D85;&#x8FC7;&#xFF0C;&#x56E0;&#x4E3A;&#x521B;&#x5EFA;&#x4E8B;&#x4EF6;&#x6C38;&#x8FDC;&#x9700;&#x8981;&#x6BD4;&#x66F4;&#x6539;&#x65F6;&#x95F4;&#x8981;&#x65E9;
    $created_at=$faker-&gt;dateTimeThisMonth($updated_at);
    return [
        &apos;title&apos; =&gt; $sentence,
        &apos;body&apos; =&gt; $faker-&gt;text(),
        &apos;excerpt&apos; =&gt; $sentence,
        &apos;created_at&apos; =&gt; $created_at,
        &apos;updated_at&apos; =&gt; $updated_at,
    ];
});
</code></pre><p>&#x6211;&#x4EEC;&#x4F7F;&#x7528;sentence()&#x968F;&#x673A;&#x751F;&#x6210;&#x3010;&#x5C0F;&#x6BB5;&#x843D;&#x3011;&#x6587;&#x672C;&#x7528;&#x4EE5;&#x586B;&#x5145;title&#x6807;&#x9898;&#x5B57;&#x6BB5;&#x548C;excerpt&#x6458;&#x5F55;&#x5B57;&#x6BB5;&#x3002;text()&#x65B9;&#x6CD5;&#x4F1A;&#x751F;&#x6210;&#x5927;&#x6BB5;&#x7684;&#x968F;&#x673A;&#x6587;&#x672C;&#xFF0C;&#x6B64;&#x5904;&#x6211;&#x4EEC;&#x6765;&#x586B;&#x5145;&#x8BDD;&#x9898;&#x7684;body&#x5185;&#x5BB9;&#x5B57;&#x6BB5;&#xFF0C;</p>
<h3 id="3-&#x8BDD;&#x9898;&#x7684;&#x6570;&#x636E;&#x586B;&#x5145;"><a name="3-&#x8BDD;&#x9898;&#x7684;&#x6570;&#x636E;&#x586B;&#x5145;" class="anchor-navigation-ex-anchor" href="#3-&#x8BDD;&#x9898;&#x7684;&#x6570;&#x636E;&#x586B;&#x5145;"><i class="fa fa-link" aria-hidden="true"></i></a><a name="3-&#x8BDD;&#x9898;&#x7684;&#x6570;&#x636E;&#x586B;&#x5145;" class="plugin-anchor" href="#3-&#x8BDD;&#x9898;&#x7684;&#x6570;&#x636E;&#x586B;&#x5145;"><i class="fa fa-link" aria-hidden="true"></i></a>3. &#x8BDD;&#x9898;&#x7684;&#x6570;&#x636E;&#x586B;&#x5145;</h3>
<p>&#x5B8C;&#x6210;TopicFactory&#x6570;&#x636E;&#x5DE5;&#x5382;&#x7684;&#x5B9A;&#x5236;&#x540E;&#xFF0C;&#x63A5;&#x4E0B;&#x6765;&#x6211;&#x4EEC;&#x5F00;&#x59CB;&#x4E66;&#x5199;&#x586B;&#x5145;&#x90E8;&#x5206;&#x7684;&#x903B;&#x8F91;:</p>
<pre><code>&#x279C; kaleo@zhou  ~/Code/kaleobbs git:(master) &#x2717; vim database/seeds/TopicsTableSeeder.php
</code></pre><p>&#x5185;&#x5BB9;&#x5982;&#x4E0B;:</p>
<pre><code>&lt;?php

use Illuminate\Database\Seeder;
use App\Models\Topic;
use App\Models\User;
use App\Models\Category;

class TopicsTableSeeder extends Seeder
{
    public function run()
    {
        //&#x6240;&#x6709;&#x7528;&#x6237;ID&#x6570;&#x7EC4;&#xFF0C;&#x5982;:[1,2,3,4]
        $user_ids=User::all()-&gt;pluck(&apos;id&apos;)-&gt;toArray();
        //&#x6240;&#x6709;&#x5206;&#x7C7B;ID&#x6570;&#x7EC4;
        $category_ids=Category::all()-&gt;pluck(&apos;id&apos;)-&gt;toArray();
        //&#x83B7;&#x53D6;Faker&#x5B9E;&#x4F8B;
        $faker=app(Faker\Generator::class);

        $topics = factory(Topic::class)-&gt;times(50)-&gt;make()-&gt;each(function ($topic, $index) 
        use($user_ids,$category_ids)
        {
            //&#x4ECE;&#x7528;&#x6237;ID&#x6570;&#x7EC4;&#x4E2D;&#x968F;&#x673A;&#x53D6;&#x4E00;&#x4E2A;&#x5E76;&#x8D4B;&#x503C;
            $topic-&gt;user_id =$faker-&gt;randomElement($user_ids);
            //&#x8BDD;&#x9898;&#x5206;&#x7C7B;
            $topic-&gt;category_id=$faker-&gt;randomElement($category_ids);

        });

        Topic::insert($topics-&gt;toArray());
    }

}
</code></pre><h3 id="4-&#x6CE8;&#x518C;&#x6570;&#x636E;&#x586B;&#x5145;"><a name="4-&#x6CE8;&#x518C;&#x6570;&#x636E;&#x586B;&#x5145;" class="anchor-navigation-ex-anchor" href="#4-&#x6CE8;&#x518C;&#x6570;&#x636E;&#x586B;&#x5145;"><i class="fa fa-link" aria-hidden="true"></i></a><a name="4-&#x6CE8;&#x518C;&#x6570;&#x636E;&#x586B;&#x5145;" class="plugin-anchor" href="#4-&#x6CE8;&#x518C;&#x6570;&#x636E;&#x586B;&#x5145;"><i class="fa fa-link" aria-hidden="true"></i></a>4. &#x6CE8;&#x518C;&#x6570;&#x636E;&#x586B;&#x5145;</h3>
<p>&#x6211;&#x4EEC;&#x9700;&#x8981;&#x5C06;DatabaseSeeder.php&#x4E2D;TopicsTableSeeder&#x4E2D;&#x7684;&#x6CE8;&#x91CA;&#x53BB;&#x6389;:</p>
<pre><code>&#x279C; kaleo@zhou  ~/Code/kaleobbs git:(master) &#x2717; vim database/seeds/DatabaseSeeder.php
</code></pre><p>&#x4FEE;&#x6539;&#x5982;&#x4E0B;:</p>
<pre><code>&lt;?php

use Illuminate\Database\Seeder;

class DatabaseSeeder extends Seeder
{
    /**
     * Seed the application&apos;s database.
     *
     * @return void
     */
    public function run()
    {
         $this-&gt;call(UsersTableSeeder::class);
         $this-&gt;call(TopicsTableSeeder::class);
    }
}
</code></pre><h2 id="&#x6267;&#x884C;&#x586B;&#x5145;&#x547D;&#x4EE4;"><a name="&#x6267;&#x884C;&#x586B;&#x5145;&#x547D;&#x4EE4;" class="anchor-navigation-ex-anchor" href="#&#x6267;&#x884C;&#x586B;&#x5145;&#x547D;&#x4EE4;"><i class="fa fa-link" aria-hidden="true"></i></a><a name="&#x6267;&#x884C;&#x586B;&#x5145;&#x547D;&#x4EE4;" class="plugin-anchor" href="#&#x6267;&#x884C;&#x586B;&#x5145;&#x547D;&#x4EE4;"><i class="fa fa-link" aria-hidden="true"></i></a>&#x6267;&#x884C;&#x586B;&#x5145;&#x547D;&#x4EE4;</h2>
<pre><code>vagrant@homestead:~/Code/kaleobbs$ php artisan migrate:refresh --seed
Rolling back: 2019_04_14_163055_create_topics_table
Rolled back:  2019_04_14_163055_create_topics_table
Rolling back: 2019_04_14_122835_seed_categories_data
Rolled back:  2019_04_14_122835_seed_categories_data
Rolling back: 2019_04_14_091133_create_categories_table
Rolled back:  2019_04_14_091133_create_categories_table
Rolling back: 2019_04_08_202505_add_avatar_and_introduction_to_users_table
Rolled back:  2019_04_08_202505_add_avatar_and_introduction_to_users_table
Rolling back: 2014_10_12_100000_create_password_resets_table
Rolled back:  2014_10_12_100000_create_password_resets_table
Rolling back: 2014_10_12_000000_create_users_table
Rolled back:  2014_10_12_000000_create_users_table
Migrating: 2014_10_12_000000_create_users_table
Migrated:  2014_10_12_000000_create_users_table
Migrating: 2014_10_12_100000_create_password_resets_table
Migrated:  2014_10_12_100000_create_password_resets_table
Migrating: 2019_04_08_202505_add_avatar_and_introduction_to_users_table
Migrated:  2019_04_08_202505_add_avatar_and_introduction_to_users_table
Migrating: 2019_04_14_091133_create_categories_table
Migrated:  2019_04_14_091133_create_categories_table
Migrating: 2019_04_14_122835_seed_categories_data
Migrated:  2019_04_14_122835_seed_categories_data
Migrating: 2019_04_14_163055_create_topics_table
Migrated:  2019_04_14_163055_create_topics_table
Seeding: UsersTableSeeder
Seeding: TopicsTableSeeder
Database seeding completed successfully.
</code></pre><p>&#x6548;&#x679C;
<img src="http://images.kaleozhou.top/5.4-03.png" alt="5.4-03.png"></p>
<footer class="page-footer"><span class="copyright">Copyright &#xA9; kaleozhou 2019 all right reserved&#xFF0C;powered by Gitbook</span><span class="footer-modification">&#x8BE5;&#x6587;&#x4EF6;&#x4FEE;&#x8BA2;&#x65F6;&#x95F4;&#xFF1A;
2019-05-20 16:16:24
</span></footer>
                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                <a href="3.html" class="navigation navigation-prev " aria-label="Previous page: 5.3 生成话题骨架">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
                <a href="5.html" class="navigation navigation-next " aria-label="Next page: 5.5 话题列表页面">
                    <i class="fa fa-angle-right"></i>
                </a>
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"5.4 假数据填充","level":"1.6.4","depth":2,"next":{"title":"5.5 话题列表页面","level":"1.6.5","depth":2,"path":"chapter5/5.md","ref":"chapter5/5.md","articles":[]},"previous":{"title":"5.3 生成话题骨架","level":"1.6.3","depth":2,"path":"chapter5/3.md","ref":"chapter5/3.md","articles":[]},"dir":"ltr"},"config":{"plugins":["-sharing","splitter","expandable-chapters-small","anchors","donate","sharing-plus","anchor-navigation-ex","tbfed-pagefooter","favicon"],"styles":{"website":"./styles/website.css"},"pluginsConfig":{"tbfed-pagefooter":{"copyright":"Copyright &copy kaleozhou 2019","modify_label":"该文件修订时间：","modify_format":"YYYY-MM-DD HH:mm:ss"},"github":{"url":"https://gitee.com/kaleozhou"},"splitter":{},"search":{},"sharing-plus":{"qq":false,"all":["facebook","google","twitter","instapaper","linkedin","pocket","stumbleupon"],"douban":false,"facebook":true,"weibo":false,"instapaper":false,"whatsapp":false,"hatenaBookmark":false,"twitter":true,"messenger":false,"line":false,"vk":false,"pocket":true,"google":false,"viber":false,"stumbleupon":false,"qzone":false,"linkedin":false},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"donate":{"alipay":"http://images.kaleozhou.top/zanshang.png","alipayText":" ","button":"赞赏","title":"","wechat":"","wechatText":"微信打赏"},"fontsettings":{"theme":"white","family":"sans","size":2},"highlight":{},"anchor-navigation-ex":{"associatedWithSummary":true,"float":{"floatIcon":"fa fa-navicon","level1Icon":"","level2Icon":"","level3Icon":"","showLevelIcon":false},"mode":"float","multipleH1":true,"pageTop":{"level1Icon":"","level2Icon":"","level3Icon":"","showLevelIcon":false},"printLog":false,"showGoTop":true,"showLevel":false},"favicon":{"shortcut":"./book.ico","bookmark":"./book.ico","appleTouch":"./book.ico","appleTouchMore":{"120x120":"./book.ico","180x180":"./book.ico"}},"github-buttons":{"buttons":[{"user":"kaleozhou","repo":"guanwang","type":"star","size":"small","count":true}]},"expandable-chapters-small":{},"sharing":{"qq":true,"all":["weibo","qq","qzone"],"douban":true,"facebook":false,"weibo":true,"instapaper":false,"whatsapp":false,"hatenaBookmark":false,"twitter":false,"messenger":false,"line":false,"vk":false,"pocket":false,"google":false,"viber":false,"stumbleupon":false,"qzone":true,"linkedin":false},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false},"anchors":{}},"theme":"default","author":"kaleozhou","pdf":{"pageBreaksBefore":"/","paperSize":"a4","margin":{"right":30,"left":30,"top":30,"bottom":50},"fontSize":18,"pageSize":"a4","fontFamily":"Arial","doc":true,"chapterMark":"pagebreak","pageNumbers":true},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"Laravel学习-从零开发论坛系统","language":"zh-hans","links":{"sidebar":{"我的博客":"http://www.kaleozhou.top"}},"gitbook":"3.2.3","description":"laravel框架开发论坛系统"},"file":{"path":"chapter5/4.md","mtime":"2019-05-20T08:16:24.619Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2019-05-25T02:56:39.861Z"},"basePath":"..","book":{"language":""}});
        });
    </script>
</div>

        
    <script src="../gitbook/gitbook.js"></script>
    <script src="../gitbook/theme.js"></script>
    
        
        <script src="../gitbook/gitbook-plugin-splitter/splitter.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-expandable-chapters-small/expandable-chapters-small.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-donate/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-sharing-plus/buttons.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-search/search-engine.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-search/search.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    

    </body>
</html>

